package com.ctshk.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * 车次类型
 */
@AllArgsConstructor
public enum TrainNumberType {

    // 车次类型
    MTR_DYNAMIC(1, "港鐵動感號"),
    GC_HIGH(2, "G/C高鐵城際"),
    D_TRAIN(3, "D動車"),
    ORDINARY_TRAIN(4, "普通列車"),
    DIRECT_EXPRESS(5, "直达特快"),
    KTT(6, "KTT"),
    EXPRESS_TRAIN(7, "高速列車"),
    ;

    @Getter
    @Setter
    private int code;

    @Getter
    @Setter
    private String value;

    public static String parseValue(int code){
        for (TrainNumberType type : TrainNumberType.values()) {
            if (type.code == code) {
                return type.getValue();
            }
        }
        return null;
    }
}
